#include <sys_head.h>

void abc(int signum)
{
    //printf("收到%d信号\n",signum);
    if (signum == SIGINT)
    {
        printf("是否要退出?\n");
        char buf[128];
        scanf("%s", buf);
        if (strcmp(buf, "yes") == 0)
        {
            exit(0);
        }
        else if (strcmp(buf, "no") == 0)
        {
            printf("点错了，不退出\n");
        }
        else
        {
            printf("请输入正确的选项\n");
        }
    }
}

int main(int argc, char const *argv[])
{
    signal(SIGINT,abc);
    //signal(SIGALRM,abc);
    //alarm(5);
    //pause();
    while (1)
    {
        // printf("11111\n");
        // sleep(1);
        // raise(SIGINT);
    }
    
    return 0;
}
